package com.dailyblue.java.standard.thread.demo;

public class Producer extends Thread {

    private Dealer dealer;

    public Producer(Dealer dealer) {
        this.dealer = dealer;
    }

    @Override
    public void run() {
        // 负责生产，负责生产商品
        for (int i = 1; i < 21; i++) {
            Goods g = new Goods(i);
            System.out.println("生产了产品：" + g);
            dealer.restock(g);
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
